package com.sparsearr.datastructures.ztr.linkedlist;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Stack;

/**
 * @Author: ZhaoTR
 * @Date: Created in 2025/4/6 21:00
 * @Description: 栈的基本使用
 * @Version: 1.0
 */

public class TestStack {
    private static final Logger logger = LogManager.getLogger(TestStack.class);

    public static void main(String[] args) {
        Stack<String> stack = new Stack();
        // 入栈
        stack.add("a");
        stack.add("b");
        stack.add("c");
        stack.add("d");

        // 栈顶元素出栈
        while (stack.size() > 0){
            // 栈顶元素出栈
            System.out.println(stack.pop());
        }
    }
}
